home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define BlockSize 17
- #define CorrectTime 2
-
- void CircularWipe(GrafPtr);
-
- /* Trace a region from the center to the topleft corner, over <BlockSize> pixels,
- and back to the center. Fill that in and move the region parameters +BlockSize.
- Repeat for all sides. */
-
- void CircularWipe(GrafPtr sourceGrafPtr)
- {
- RgnHandle curregion;
- Rect source;
- int cx,cy,gap,lastx,lasty;
-
- cx = MAIN_WINDOW_WIDTH / 2;
- cy = MAIN_WINDOW_HEIGHT / 2;
-
- curregion=NewRgn();
- source.top=source.left=0;
- source.bottom=MAIN_WINDOW_HEIGHT;
- source.right=MAIN_WINDOW_WIDTH;
-
- gap=BlockSize;
- lastx=0;
- do /* top quadrant */
- {
- StartTiming();
- SetEmptyRgn(curregion);
- MoveTo(cx,cy);
- OpenRgn();
- LineTo(lastx,0);
- LineTo(gap,0);
- LineTo(cx,cy);
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
- lastx=gap;
- gap+=BlockSize;
- TimeCorrection(CorrectTime);
- }
- while (gap<MAIN_WINDOW_WIDTH+BlockSize);
-
- gap=BlockSize;
- lasty=0;
- do /* right quadrant */
- {
- StartTiming();
- SetEmptyRgn(curregion);
- MoveTo(cx,cy);
- OpenRgn();
- LineTo(MAIN_WINDOW_WIDTH,lasty);
- LineTo(MAIN_WINDOW_WIDTH,gap);
- LineTo(cx,cy);
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
- lasty=gap;
- gap+=BlockSize;
- TimeCorrection(CorrectTime);
- }
- while (gap<MAIN_WINDOW_HEIGHT+BlockSize);
-
- lastx=MAIN_WINDOW_WIDTH;
- gap=MAIN_WINDOW_WIDTH-BlockSize;
- do /* bottom quadrant */
- {
- StartTiming();
- SetEmptyRgn(curregion);
- MoveTo(cx,cy);
- OpenRgn();
- LineTo(lastx,MAIN_WINDOW_HEIGHT);
- LineTo(gap,MAIN_WINDOW_HEIGHT);
- LineTo(cx,cy);
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
- lastx=gap;
- gap-=BlockSize;
- TimeCorrection(CorrectTime);
- }
- while (gap>-BlockSize);
-
- lasty=MAIN_WINDOW_HEIGHT;
- gap=MAIN_WINDOW_HEIGHT-BlockSize;
- do /* left quadrant */
- {
- StartTiming();
- SetEmptyRgn(curregion);
- MoveTo(cx,cy);
- OpenRgn();
- LineTo(0,lasty);
- LineTo(0,gap);
- LineTo(cx,cy);
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
- lastx=gap;
- gap-=BlockSize;
- TimeCorrection(CorrectTime);
- }
- while (gap>-BlockSize);
-
- DisposeRgn(curregion);
- }
-